PHP Dropdown menu [closed]

Posted by rShetty on Stack Overflow See other posts from Stack Overflow or by rShetty
Published on 2011-11-28T14:37:47Z Indexed on 2012/10/20 17:01 UTC
Read the original article Hit count: 168

Filed under:
|
<br><h2>Select a Tag</h2></br>

<?php

$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("portal", $con);

$query = "SELECT tag_name FROM tags";
$result = mysql_query($query);

?>
<select name="tag_name" id="abc">
<option size=30 selected>Select</option>
<?php
while($array = mysql_fetch_assoc($result)){
?>
<option value ="<?php echo $array['tag_name'];?>"><?php echo $array['tag_name'];?>      
</option>
 <?php

}
?>
</select>     <br><br>

This is a snippet of code for getting the dropdown menu in the page. I have a database named portal and table named tags with tag_name as the attribute. Do help me to find the error in the program. I am not getting the tag_names in the dropdown menu

© Stack Overflow or respective owner

Related posts about php

Related posts about Web